package prolog.fluents
import scala.collection.JavaConversions._
//import scala.collection.jcl.ArrayList;
import java.util.{ArrayList => al};
import prolog.terms.Prog;
import prolog.terms.{Sink => si};
import prolog.terms.Term;

/**
  Builds  Fluents from Java
  Streams
*/
 class TermCollector1(buffer:al,p:Prog) extends si {
  protected var buffer:al;
  private var p:Prog;
  
  def TermCollector1(p:Prog){p;new ArrayList()}
 //   super.p;
    //this.p=p;
    //this.buffer=new ArrayList();
  //}
  
  def putElement(T:Term):Int ={
    buffer.add(T);
    1;
  }
  
  override def stop():Unit = {
    buffer=null;
  }
  
  override def collect():Term = { new JavaSource1(buffer,p);}
}